<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<div class="row">
	<div class="col-xs-12">
		<div class="btn-group m-b-1" role="group">
			<?php echo admin_tab_active($menu['pay']['tab'], 'successrate');?>
		</div>
	</div>
</div>

<form method="get" class="form-inline m-b-xs" action="<?php echo url('pay-successrate');?>">
	<div class="row" style="margin-top:5px;">
		<div class="col-lg-3">
			<div class="form-group" style="width:100%;">
				<select class="form-control" name="channel" style="width:100%;">
					<option value="0">全部通道</option>
					<?php foreach($channels as $c){ ?>
					<option value="<?php echo $c['id'];?>" <?php if($channel==$c['id']){echo 'selected';} ?>><?php echo $c['name'];?></option>
					<?php } ?>
				</select>
			</div>
		</div>
		<div class="col-lg-4">
			<div class="form-group">
				<div class="input-group" style="background-color:#fff;">
					<span class="input-group-addon"><i class="icon icon-calendar"></i></span>
					<input type="text" name="fdate" class="form_datetime form-control" value="<?php echo $fdate;?>">
					<span class="input-group-addon">至</span>
					<input type="text" name="tdate" class="form_datetime form-control" value="<?php echo $tdate;?>">
				</div>
			</div>
		</div>
		<div class="col-lg-2">
			<button type="submit" class="btn btn-success" style="width:100%;">
				<i class="icon icon-search"></i>
				立即查询
			</button>
		</div>
	</div>
</form>

<div class="row">
	<div class="col-lg-12">
		<div class="card">
			<div class="table-responsive">
				<table class="table" style="min-width: 800px">
					<thead>
						<tr>
							<th class="text-center">通道</th>
							<th class="text-center">总订单</th>
							<th class="text-center">成功订单</th>
							<th class="text-center">失败订单</th>
							<th class="text-center">成功率</th>
						</tr>
					</thead>
					<tbody id="userlist">
						<?php
						$nums_total=$nums_success_total=0;
						if($log){foreach($log as $l){
						$nums_total+=$l['nums'];
						$nums_success_total+=$l['nums_success'];
						?>
						<tr uid="<?php echo $l['id']; ?>">
							<td class="text-center"><?php echo $l['name']; ?></td>
							<td class="text-center"><?php echo $l['nums']; ?> </td>
							<td class="text-center"><?php echo $l['nums_success']; ?> </td>
							<td class="text-center"><?php echo $l['nums']-$l['nums_success']; ?> </td>
							<td class="text-center"><?php if($l['nums']==0){echo 0;}else{echo round($l['nums_success']/$l['nums']*100,2);}?>% </td>
						</tr>
						<?php }} ?>
                      	<tr>
                          	<td class="text-center">合计</td>
                          	<td class="text-center"><?php echo $nums_total; ?> </td>
                          	<td class="text-center"><?php echo $nums_success_total; ?> </td>
							<td class="text-center"><?php echo $nums_total-$nums_success_total; ?> </td>
                          	<td class="text-center">&nbsp;</td>
                        </tr>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>
<link rel="stylesheet" href="../view/css/datetimepicker.css?r=1">
<script src="../view/js/datetimepicker.js?r=1" type="text/javascript"></script>

<script>
//日期插件
$(".form_datetime").datetimepicker({
	language:  'zh',
	format: 'mm/dd/yyyy',//显示格式
	todayHighlight: 1,//今天高亮
	minView: "month",//设置只显示到月份
	startView:2,
	forceParse: 0,
	autoclose: 1//选择后自动关闭
});

$('#nav_pc li.pay, #nav_mobile li.pay').tab('show');
</script>